﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Model;
using BLL;
using System.Data.SqlClient;

namespace DiChanAPI.Controllers
{
    public class DepartmentController : ApiController
    {
       
        // GET api/department
        /// <summary>
        /// 部门表显示及查询
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public IEnumerable<Department> GetList(string name)
        {
            if (name == null || name == "")
            {
                return new DepartmentBLL().GetList();
            }
            else
            {
                return new DepartmentBLL().GetList().Where(n => n.Department_Name.Contains(name));
            }
        }

        // GET api/department/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/department
        public void Post([FromBody]string value)
        {
        }

        // PUT api/department/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/department/5
        public void Delete(int id)
        {
        }
    }
}
